using System.Collections.Generic;
using UnityEngine;

namespace IQIGame.Onigao.GameAOT
{
    public static class PhysicsUtility
    {
        static RaycastHit[] raycastHits10 = new RaycastHit[10];
        public static bool RaycastNonAllocList10(Vector3 origin, Vector3 direction, ICollection<RaycastHit> results, [UnityEngine.Internal.DefaultValue("Mathf.Infinity")] float maxDistance, [UnityEngine.Internal.DefaultValue("DefaultRaycastLayers")] int layerMask)
        {
            var ray = new Ray(origin, direction);
            int count = Physics.RaycastNonAlloc(ray, raycastHits10, maxDistance, layerMask);
            for (int i = 0; i < count; i++)
            {
                results.Add(raycastHits10[i]);
            }
            return count > 0;
        }

        public static int RaycastNonAlloc10(Vector3 origin, Vector3 direction, out IReadOnlyList<RaycastHit> results, [UnityEngine.Internal.DefaultValue("Mathf.Infinity")] float maxDistance, [UnityEngine.Internal.DefaultValue("DefaultRaycastLayers")] int layerMask)
        {
            var ray = new Ray(origin, direction);
            results = raycastHits10;
            return Physics.RaycastNonAlloc(ray, raycastHits10, maxDistance, layerMask);
        }
    }
}
